home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
CSUBR.LZH
/
ITOH.C
< prev
next >
Wrap
Text File
|
1980-01-01
|
306b
|
17 lines
itoh(n, s) /* convert n to char in s (hex) */
char s[]; /* from C Answer Book - Tondo/Gimpel */
unsigned n;
{
int h, i;
i = 0;
do {
h = n % 16; /* get next digit */
s[i++] = (h <= 9) ? h+'0' : h+'a'-10;
} while ((n /= 16) != 0); /* delete */
s[i] = '\0';
reverse(s);
}